package com.tz.service;

import com.tz.dao.ProductDao;
import com.tz.entity.Category;
import com.tz.entity.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Tinyang on 2016/7/27.
 */
@Repository
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductDao productDao;
    public  Product getProduct(long id){
        return productDao.selectProduct(id);
    }
    public List<Product> getAllProducts() {
        return productDao.selectAllProducts();
    }

    public List<Category> getAllCategories() {
        return productDao.selectAllCategories();
    }

    public List<Product> getProductsByCId(long id) {
        return productDao.selectProductsByCId(id);
    }
}